#ifndef MPLOT_H
#define MPLOT_H

#include <QMainWindow>
#include "qcustomplot.h"
#include <QTimer>
#include <QPoint> // 添加这一行

class MPlot : public QCustomPlot
{
public:
    MPlot(QCustomPlot *parent);
    ~MPlot();
    void start();
    void stop();
    void clearData();
    void append(double data);

protected:
    void mousePressEvent(QMouseEvent *event) override;
    void mouseReleaseEvent(QMouseEvent *event) override;
    void mouseMoveEvent(QMouseEvent *event) override;
    void wheelEvent(QWheelEvent *event) override;

private slots:
    void updateGraph();


private:
    QCustomPlot *customPlot;
    QTimer *dataTimer;
    QPoint rightClickStartPos; // 声明右键起始位置变量
    QVector<double> xData, yData;
    double time;
};

#endif // MPLOT_H
